The test enabling class, allowing registration within the UnitTester. More...
Public Member Functions | |
TestClass () | |
TestClass (const nkLog::StringView &name) | |
virtual | ~TestClass () |
void | execute (const TestRunParameters ¶meters) const |
bool | setClassInitFunction (const std::function< bool()> &func) |
bool | setClassShutdownFunction (const std::function< void()> &func) |
bool | setTestFunctionInitFunction (const std::function< bool()> &func) |
bool | setTestFunctionShutdownFunction (const std::function< void()> &func) |
Public Attributes | |
FunctionSet | _testFunctions |
Registered functions to run. | |
ClassInitFunctionDescriptor * | _classInitFunction |
Callback called before calling the test functions. | |
ClassShutdownFunctionDescriptor * | _classShutdownFunction |
Callback called after all test functions have been called. | |
ClassInitFunctionDescriptor * | _testFunctionInitFunction |
Callback called before calling each function. | |
ClassShutdownFunctionDescriptor * | _testFunctionShutdownFunction |
Callback called after calling each function. | |
const char * | _name |
Class name for tracking purposes. | |
The test enabling class, allowing registration within the UnitTester.
Implementing this class enables registering within the UnitTester for a run sequence. Utilities are provided within the class to ease the process.
An example of usage would be :
To avoid name conflicts, you can use the NS variant of the macros to register classes and their namespaces. However, in the case of using the NS variant, do not forget to close it using the corresponding macro, like so :
nkDebug::TestClass::TestClass | ( | ) |
Default constructor.
nkDebug::TestClass::TestClass | ( | const nkLog::StringView & | name | ) |
Named constructor.
name | The name to attach to the class. |
|
virtual |
Destructor.
void nkDebug::TestClass::execute | ( | const TestRunParameters & | parameters | ) | const |
Requests the class to run all of its registered functions.
parameters | The run parameters. |
bool nkDebug::TestClass::setClassInitFunction | ( | const std::function< bool()> & | func | ) |
Sets the callback called before the class runs all of its functions in a run.
func | The function to call. |
bool nkDebug::TestClass::setClassShutdownFunction | ( | const std::function< void()> & | func | ) |
Sets the callback called after all functions from the class have been run.
func | The function to call. |
bool nkDebug::TestClass::setTestFunctionInitFunction | ( | const std::function< bool()> & | func | ) |
Sets the callback called before each function run.
func | The function to call. |
bool nkDebug::TestClass::setTestFunctionShutdownFunction | ( | const std::function< void()> & | func | ) |
Sets the callback called after each function run.
func | The function to call. |